#include "connection.h"
using namespace ns_conn;

int main()
{
    // 广播推送消息测试
    AsyncWorker::ptr wp = make_shared<AsyncWorker>();
    Connection::ptr conptr = make_shared<Connection>("127.0.0.1", 8888, wp);
    Channel::ptr cp = conptr->createChannel();
    google::protobuf::Map<std::string, std::string> args;
    
    cp->declareExchange("e1", TOPIC, true, false, args);
    cp->declareQueue("q1", true, false, false, args);
    cp->declareQueue("q2", true, false, false, args);
    cp->queueBind("e1", "q1", "sport.#");
    cp->queueBind("e1", "q2", "sport.basketball");

    Attributes att;
    att.set_id("***");
    att.set_del_mod(DURABLE);
    att.set_routing_key("sport.football");

    for (int i = 0; i < 10; i++)
    {
        cp->basicPublish("e1", &att, "hello MessageQueue: " + to_string(i + 1));
    }
    conptr->closeChannel(cp);

    return 0;
}